<?php
$this->title = "Profle - Medical Edit";
$this->headTitle($this->title);
?>	

		<!-- start content -->
		<div id="mededit_inside" class="content">
			
		<!--  Glavno meni -->
			<div id="InnerMenu" >
				<?php $session = Zend_Registry::get('session');?>
				<ul >
					<li style=" display: inline; "><a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'basic'))."?id=". $this->viewuser; ?>">Basic Info</a></li>
					<li style=" display: inline; "><a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'medical'))."?id=". $this->viewuser; ?>">Medical Info</a></li>					
					<li style=" display: inline; "><a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'Interests'))."?id=". $this->viewuser; ?>">Interests</a></li>					
				</ul>
			</div>
			
				<form id="form_medical_edit" name="medical" method="post">
				<div id="div_EditArea">
					
					<div id="div_PermisionsBasic">
						<?php if ($session->user['id'] == $this->Query){?>					
							<label for="Permisions">Permitions</label><br>
							<input type="radio" name="rbl_permitions" value="1" <?php $permitions =(int)$this->medicalInfo_user['ViewPermitions'];if ($permitions ==1){  ?> checked="checked" <?php } ?> ><label for="Only_me">Only Me</label> 
							<input type="radio" name="rbl_permitions" value="2" <?php $permitions =(int)$this->medicalInfo_user['ViewPermitions'];if ($permitions ==2){  ?> checked="checked" <?php } ?>><label for="Doctors">Doctors</label>
							<input type="radio" name="rbl_permitions" value="3" <?php $permitions =(int)$this->medicalInfo_user['ViewPermitions'];if ($permitions ==3){  ?> checked="checked" <?php } ?>><label for="Friends_and_Doctors">Friends and Doctors</label> 
							<input type="radio" name="rbl_permitions" value="4" <?php $permitions =(int)$this->medicalInfo_user['ViewPermitions'];if ($permitions ==4){  ?> checked="checked" <?php } ?>><label for="All">All</label> 
						<?php }?> 
					</div>
										
					<label for="Height">Height: </label><input  type="text" name="txt_Height" id="txt_Height" value="<?php echo $this->medicalInfo_user['Height'];?>" /><br/>
					<label for="Weight">Weight:  </label><input  type="text" name="txt_Weight" id="txt_Weight"  value="<?php echo $this->medicalInfo_user['Weight'];?>"/><br/>
					<label for="BloodGroup">Bloodgroup: </label>
						<select name="ddl_Bloodgroup" id="ddl_Bloodgroup">
							<?php foreach($this->bloodgroups as $b){
							if ($this->medicalInfo_user['BloodGroup_id'] == $b['id']) {
								echo "<option value=" . $b['id'] . " selected=\"selected\">".$b['Name']."</option>\n";
							} else {
								echo "<option value=" . $b['id'] ." >".$b['Name']."</option>\n";
							}
						}?>
						</select><br/>
					
					<div id="threatments">
					<?php if ($this->flag_threatments == 0){?>
						<label for="CurrentThreatments:">Current Threatments: None</label><br/>
						<input type="button" value="Add Threatment" id="btn_AddThreatment" name="btn_AddThreatment"/>
					<?php }
					else{ ?>
					
						<label for="CurrentThreatments:">Current Threatments: </label><br/>
						<table>
						<tr>
							<th>Name</th>
						    <th>Description</th>
						    <th>Date From</th>
						    <th>Date To</th>
						    <th>&nbsp;</th>
						</tr>
						<?php foreach($this->threatments as $Threatment) : ?>
						  <tr>
						    <td><?php echo $Threatment['Name']; ?></td>
						    <td><?php echo $Threatment['Description']; ?></td>
						    <td><?php $dateStart = new Zend_Date($Threatment['DateStart']);  echo $dateStart->toString("dd-MM-YYYY"); ?></td>
						    <td><?php $dateStart = new Zend_Date($Threatment['DateEnd']);  echo $dateStart->toString("dd-MM-YYYY");?></td>
						    <td><img alt="<?php echo $Threatment['id']; ?>" src="/med-advisor/application/layouts/scripts/css/Pictures/close.png" id="pic_deleteThreatment" class="deleteThreatment"> </td>	
						  </tr>
						<?php endforeach; ?>
						</table>
						<?php if ($this->flag_threatmentsNonActive == 1){ ?>
							<input type="button" value="Add Threatment" id="btn_AddThreatment" name="btn_AddThreatment"/>
						<?php }?>
					<?php }?>
					</div>
					
					
					<div id="conditonas">
					<?php if ($this->flag_conditions == 0){?>
						<label for="Conditions">Conditions: None</label><br/>
						<input type="button" value="Add Condition" id="btn_AddCondition" name="btn_AddCondition"/>
					<?php }
					else{ ?>					
						<label for="Conditions">Conditions:  </label><br/>
						<table>
						<tr>
							<th>Name</th>
							<th>Latin Name</th>
						    <th>Description</th>
						    <th>Have Since</th>
						    <th>&nbsp;</th>					    
						</tr>
						<?php foreach($this->conditons as $conditon) : ?>
						  <tr>
						    <td><?php echo $conditon['Name']; ?></td>
						    <td><?php echo $conditon['LatinName']; ?></td>
						    <td><?php echo $conditon['Description']; ?></td>
						    <td><?php $dateCondtion = new Zend_Date($conditon['DateCondtion'],'dd MMMM yyyy');  echo $dateCondtion->toString("MMMM yyyy"); ?></td>
						    <td><img alt="<?php echo $conditon['id']; ?>" src="/med-advisor/application/layouts/scripts/css/Pictures/close.png" id="pic_delete" class="deleteCondition"> </td>						    
						  </tr>
						<?php endforeach; ?>
						</table>
						<?php if ($this->flag_conditionsNonActive == 1){ ?>
							<input type="button" value="Add Condition" id="btn_AddCondition" name="btn_AddCondition"/>
						<?php }?>
					<?php }?>
					</div>
					
					<input type="submit" value="Save" id="btn_SaveEdit" name="btn_SaveEdit"/>
					
				</div>				
				</form>
			

		</div>
		<!-- end content -->
		
		
		<div id="pop_upMedicalThreatment">
			<form id="form_AddThreatment" name="form_AddThreatment" method="post">			
					<label for="Threatment">Threatment: </label>
							<?php if ($this->flag_threatmentsNonActive == 0){ ?>
								<label for="NoThreatment">/</label>
								<input type="Button" value="Exit" id="btn_ExitThreatmentPopUP"  name="btn_ExitThreatmentPopUP"/>							
							<?php } else{?>
							<select name="ddl_Threatment" id="ddl_Threatment">
								<?php foreach($this->threatmentsNonActive as $threatmentsNonActive){							
									echo "<option value=" . $threatmentsNonActive['id'] ." >".$threatmentsNonActive['Name']."</option>\n";								
								}?>						
							</select><br/>
							<label for="DateFrom">Date From:</label>
							<input type="text" id="txt_ThreatmentDateFrom" name="txt_ThreatmentDateFrom" ><br>
							<label for="DateTo">Date To:</label>
							<input type="text" id="txt_ThreatmentDateTo" name="txt_ThreatmentDateTo" ><br>
							<input type="submit" value="Save Threatment" id="btn_ThreatmentSave"  name="btn_ThreatmentSave"/>
							<input type="button" name="btn_AddCancelThreatment" id="btn_AddCancelThreatment" value="Cancel">
							<?php }?>		
			</form>
		</div>

<div style="clear:both; font-size:0px;">&nbsp;</div>
		
		<div id="pop_upMedicalCondition">
			<form id="form_AddCondtion" name="form_AddCondtion" method="post">			
					<label for="Condtiion">Condtiion: </label>
							<?php if ($this->flag_conditionsNonActive == 0){ ?>
								<label for="NoConditions">/</label>
								<input type="Button" value="Exit" id="btn_ExitCondtionsPopUP"  name="btn_ExitCondtionsPopUP"/>							
							<?php } else{?>
							<select name="ddl_Conditions" id="ddl_Conditions">
								<?php foreach($this->condtionsNonActive as $condtionNonActive){							
									echo "<option value=" . $condtionNonActive['id'] ." >".$condtionNonActive['Name']."</option>\n";								
								}?>						
							</select><br/>
							<label for="DateCondtion">Date Condition:</label>
							<input type="text" id="txt_CondtitionDate" name="txt_CondtitionDate" ><br>							
							<input type="submit" value="Save Condtion" id="btn_CondtionSave"  name="btn_CondtionSave"/>
							<input type="button" name="btn_AddCancelCondition" id="btn_AddCancelCondition" value="Cancel">
							<?php }?>		
			</form>		
		</div>
		
		<div id="pop_upDeleteCondition">
			<form id="form_DeleteCondition" name="form_DeleteCondition" method="post">
				<p>Are you sure that you want to delete this Condition?</p>
				
				<input type="submit" name="btn_DeleteCondition" id="btn_DeleteCondition" value="Yes">
				<input type="button" name="btn_DeleteCancelCondition" id="btn_DeleteCancelCondition" value="No">
				<input type="hidden" id="hdn_ConditionCurrentDelete" name="hdn_ConditionCurrentDelete" value="">
			</form>
		</div>
		
		<div id="pop_upDeleteThreatment">
			<form id="form_DeleteThreatment" name="form_DeleteThreatment" method="post">
				<p>Are you sure that you want to delete this Threatment?</p>
				
				<input type="submit" name="btn_DeleteThreatment" id="btn_DeleteThreatment" value="Yes">
				<input type="button" name="btn_DeleteCancelThreatment" id="btn_DeleteCancelThreatment" value="No">
				<input type="hidden" id="hdn_ThreatmentCurrentDelete" name="hdn_ThreatmentCurrentDelete" value="">
			</form>
		</div>
		
		
